package com.example.myapplication.view.ui.fragment;


import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.myapplication.R;


/**
 * A simple {@link Fragment} subclass.
 */
public class Fragment_A extends Fragment {

    private Button mBtnInputFragment2;
    public Fragment_A() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view= inflater.inflate(R.layout.fragment_fragment_, container, false);
        mBtnInputFragment2 = view.findViewById(R.id.button);
        mBtnInputFragment2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Navigation.findNavController(getView()).navigate(R.id.action_fragment_A_to_fragment_B);//这个id就是navigation里的action的id

            }
        });
        return view;
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }

}
